/**
 * 技师管理的增加、编辑
 * @author: minzhang
 * @update: 2016-10-13
 */

import React, {PropTypes} from 'react';
import {Link} from 'dva/router';
import {Form, Input, Modal } from 'antd';
				
const FormItem = Form.Item;

const formItemLayout = {
    labelCol: {
        span: 4,
    },
    wrapperCol: {
        span: 18,
    },
};

const RoomsManageTypeModal = ({
    typeVisible,
    typeBtnLoading,
    onTypeOk,
		onTypeCancel,
    form: {
			getFieldDecorator,
			validateFields,
			getFieldsValue,
			resetFields,
    },
}) => {

    function handleOk() {
        validateFields((errors) => {
            if (errors) {
                return;
            }
            const data = getFieldsValue();
						
            onTypeOk(data, () => {
                resetFields();
            });
        });
    }
	
		function handleCancel() {
			resetFields();
			onCancel();
    }

    const modalOpts = {
        title: '新增类型',
        visible: typeVisible,
        width: 600,
        maskClosable: false,
				onOk: handleOk,
				onCancel: onTypeCancel,
    };

    return (
        <Modal {...modalOpts}>

					<Form layout="horizontal">

						<FormItem
							label="包间类型："
							hasFeedback
							{...formItemLayout}
						>
							{getFieldDecorator('tech_nsfso', {
								rules: [
									{required: true, message: "包间类型未填写"},
								],
							})(
								<Input type="text" placeholder="请输入包间类型" />
							)}
						</FormItem>

					</Form>

        </Modal>
    );
};

RoomsManageTypeModal.propTypes = {
    typeVisible: PropTypes.any,
    typeBtnLoading: PropTypes.any,
    form: PropTypes.object,
    onOk: PropTypes.func,
    onCancel: PropTypes.func,
};

export default Form.create()(RoomsManageTypeModal);